1. Field of the Invention
The present invention relates to an on-vehicle control apparatus constructed of an electronic control unit (ECU) for controlling, for example, an engine and an on-vehicle power train including a transmission.
2. Description of the Related Art
In general, an on-vehicle control apparatus includes a CPU, a non-volatile memory, a backup RAM, a backup power supply circuit, a boot program, an address changeover circuit, a memory rewrite unit, and a backup power supply off-state determining circuit.
The CPU controls an on-vehicle device based on a control program using various control variables. The non-volatile memory, which is rewritable, stores a control program therein. The backup RAM stores the control variables therein. The backup power supply circuit is connected to a battery to supply power to the backup RAM. The boot program causes the CPU to rewrite the control program.
The address changeover circuit loads the boot program into an execution address of the CPU in rewriting the control program. The memory rewrite unit outputs a rewrite signal for causing the address changeover circuit to operate and a command signal for activating the boot program. The backup power supply off-state determining circuit usually holds a state of determining that the backup power supply circuit is on, and is fixed to a state of determining that the backup power supply circuit is off when it is turned off even once.
To check consistency of the control variables stored in the backup RAM, the control program compares a criterial value in the non-volatile memory with a predetermined value in the backup RAM when being activated.
When it is determined that the predetermined value in the backup RAM does not coincide with the criterial value in the non-volatile memory, the control program determines that the battery has been shut off, and initializes the control variables in the backup RAM.
In a case where the boot program has been used to rewrite the control program in the non-volatile memory, the control program compares the criterial value in the non-volatile memory with the predetermined value in the backup RAM in the same manner as described above when being activated after having been rewritten.
However, in a case where the resolution and the like of the control variables in the backup RAM are changed between the control program to be rewritten and the control program that has been rewritten, the CPU executes the changed control program using the control variables (last values) in the backup RAM. This may lead to, for example, an erroneous control of the engine.
Accordingly, when the control program in the non-volatile memory has been changed, the control variables in the backup RAM need to be initialized to values corresponding to a new control program in order to avoid an inconvenience resulting from an incompatibility between the changed control program and the control variables (last values) in the backup RAM.
Therefore, there has been proposed a method in which the battery is temporarily disconnected from the on-vehicle control apparatus to shut off the supply of power to the backup power supply circuit in rewriting the control program in the non-volatile memory, and the control variables in the backup RAM are initialized based on information from the backup power supply off-state determining circuit when the control program is activated after having been rewritten.
However, if the battery is disconnected every time the control program is rewritten, information stored in various kinds of other devices sharing the backup power supply circuit is also cleared.
Thus, backup RAMs in those devices need to be initialized again, which causes an increase in the number of rewrite processes and may lead to a rise in cost.
Also, a failure of initializing the backup RAM may arise if the backup power supply circuit has not been shut off, or a rise in cost may result from an increase in the number of processes of disconnection and connection.
Therefore, in such a conventional on-vehicle control apparatus as disclosed in, for example, JP 9-288573 A, an initialization flag set by the boot program is provided on the backup RAM in rewriting the control program in the non-volatile memory, and the control program initializes the control variables in the backup RAM in response to a set state of the initialization flag when being activated after having been rewritten.
In the conventional on-vehicle control apparatus, the control variables in the backup RAM are initialized in response to the set state of the initialization flag set by the boot program. However, the boot program usually remains unchanged throughout a development stage and a mass production stage. Therefore, the control variables in the backup RAM are also initialized in rewriting the control program in the development stage.
Thus, a learning process for an idle state and other such process need to be carried out every time the control program is rewritten, which causes a problem in that an efficiency of development is prevented from being enhanced.